package cn.iocoder.yudao.module.custom.dal.mysql.merchantkey;

import java.util.*;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.custom.dal.dataobject.merchantkey.MerchantKeyDO;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.yudao.module.custom.controller.admin.merchantkey.vo.*;

/**
 * 商户私钥 Mapper
 *
 * @author 芋道源码
 */
@Mapper
public interface MerchantKeyMapper extends BaseMapperX<MerchantKeyDO> {

    default PageResult<MerchantKeyDO> selectPage(MerchantKeyPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<MerchantKeyDO>()
                .eqIfPresent(MerchantKeyDO::getMerchantId, reqVO.getMerchantId())
                .eqIfPresent(MerchantKeyDO::getPrivateKey, reqVO.getPrivateKey())
                .orderByDesc(MerchantKeyDO::getId));
    }

    default List<MerchantKeyDO> selectList(MerchantKeyExportReqVO reqVO) {
        return selectList(new LambdaQueryWrapperX<MerchantKeyDO>()
                .eqIfPresent(MerchantKeyDO::getMerchantId, reqVO.getMerchantId())
                .eqIfPresent(MerchantKeyDO::getPrivateKey, reqVO.getPrivateKey())
                .orderByDesc(MerchantKeyDO::getId));
    }

}
